home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 26
/
Cream of the Crop 26.iso
/
program
/
ddj0897.zip
/
DYN401.ZIP
/
examples
/
exam14
/
main.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-09-27
|
2KB
|
96 lines
/*
*
* This source code is CONFIDENTIAL and
* PROPRIETARY to Algorithms Corporation. Unauthorized
* distribution, adaptation or use may
* be subject to civil and criminal penalties.
*
* Copyright (c) 1993 Algorithms Corporation
* 3020 Liberty Hills Drive
* Franklin, TN 37064
*
* ALL RIGHTS RESERVED.
*
*
*
*/
#include "generics.h"
main(int argc, char *argv[])
{
object obj1, obj2;
InitDynace(&argc);
/* Create two instances of the Class1 class. This will evoke the
newly defined New class method through the gNew generic. */
obj1 = gNew(Class1);
obj2 = gNew(Class1);
/* Set each instance to a different name. */
gSetName(obj1, "Object One");
gSetName(obj2, "Object Two");
/* Display the independent values associated with each instance. */
printf("obj1's name is %s\n", gGetName(obj1));
printf("obj2's name is %s\n", gGetName(obj2));
/* Evoke the NumInstances class method through the gNumInstances
generic. Notice that the argument passed is the class - not
an instance object. This is because class methods are associated
with classes. The returned value is printed. */
printf("Number of instances = %d\n", gNumInstances(Class1));
/* Dispose one of the instances. */
gDispose(obj1);
/* Display the count again. */
printf("Number of instances = %d\n", gNumInstances(Class1));
/* Dispose and display the count again. */
gDispose(obj2);
printf("Number of instances = %d\n", gNumInstances(Class1));
return 0;
}
/*
*
* This source code is CONFIDENTIAL and
* PROPRIETARY to Algorithms Corporation. Unauthorized
* distribution, adaptation or use may
* be subject to civil and criminal penalties.
*
* Copyright (c) 1993 Algorithms Corporation
* 3020 Liberty Hills Drive
* Franklin, TN 37064
*
* ALL RIGHTS RESERVED.
*
*
*
*/